<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>寻找连续5位数中的最大数</title>
</head>

<body>

</body>
<script>
    let str = '235438334';

    function strMax(str) {
        let newArr = [];
        for (let i = 0; i <= str.length % 5; i++) {
            newArr.push(Number(str.substr(i, 5)));
        }
        return Math.max(...newArr);
    }

    console.log(strMax(str));

</script>

</html>